<?php

namespace app\dao\portal;

use app\dao\BaseDao;
use app\model\pc\FacadeNotice;

class PortalInformDao extends BaseDao
{

    public function index(array $where)
    {
        return $this->search()->withoutField('website_id,update_time')->where('website_id', $where['website_id'])->paginate($where['pageSize']);
    }

    public function create(array $where)
    {
        return $this->getModel()->create($where);
    }

    public function updateDao(array $where)
    {
        return $this->search()->update($where);
    }

    public function deleteDao(array $where)
    {
        return $this->getModel()->whereIn('id', $where['id'])->update(['delete_time' => date('Y-m-d H:i:s', time())]);
    }

    public function searchTitle(array $where)
    {
        return $this->search()::withSearch(
            ['title', 'type', 'isSlideshow'],
            ['title' => $where['title'], 'type' => $where['type'],
                'isSlideshow' => $where['isSlideshow']])->where('website_id', $where['website_id'])->paginate($where['pageSize']);

    }

    protected function setModel(): string
    {
        // TODO: Implement setModel() method.
        return FacadeNotice::class;
    }
}